package com.example.socialmediaplatform.controller;

import org.springframework.messaging.handler.annotation.MessageMapping;
import com.example.socialmediaplatform.model.Notification;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.stereotype.Controller;

@Controller
public class NotificationWebSocketController {
    @Autowired
    private SimpMessagingTemplate messagingTemplate;

    public void sendNotificationToUser(String username, Notification notification) {
        messagingTemplate.convertAndSendToUser(username, "/queue/notification", notification);
    }
} 
